let Singleton = function (name) {
    this.name = name;
    this.instance = null;
};
Singleton.getInstance = function (name) {
    if (!this.instance) {
        this.instance = new Singleton(name);
    }
    return this.instance;
};

let a = Singleton.getInstance('leo1');
let b = Singleton.getInstance('leo2');

console.log( a===b );
